{template 'admin','header'}
<script language="javascript">
function change_adstype(obj)
{
	var typelist = {json_encode(array_keys($advertis->typelist))};
	var current = obj.value;
	var len = typelist.length
	var current_div = '';
	var nodes = '';
	for(i=0; i<len; i++)
	{
		current_div = document.getElementById('div_'+typelist[i]);
		nodes = current_div.childNodes;
		if(typelist[i] == current)
		{
			current_div.style.display='';
			for(j=0;j<nodes.length;j++)
			{
				if(nodes[j].tagName=='INPUT')
				{
					nodes[j].disabled = false;
				}
			}
		}
		else
		{
			current_div.style.display='none';
			for(j=0;j<nodes.length;j++)
			{
				if(nodes[j].tagName=='INPUT')
				{
					nodes[j].disabled = true;
				}
			}
		}
	}
}
</script>

<form action="{URL}" method="POST" enctype="multipart/form-data" onsubmit="return r_submit(this);">
<table class="table_form">
	<caption>修改广告</caption>
	<tr><th width="20%"><font color="red">*</font><strong>广告名称</strong></th><td><input type="text" value="{$info['adsname']}" name="adsname"></td></tr>
	<tr><th width="20%"><strong>广告描述</strong></th><td><input type="text" value="{$info['description']}" name="description"></td></tr>
	<tr>
		<th width="20%"><strong>广告类型</strong></th>
		<td>
		{loop $advertis->typelist $key $types}
		<input type="radio" {if $key==$info['adstype']}checked{/if} onclick="change_adstype(this)" name="adstype" id="type_{$key}" value="{$key}">{$types['name']}
		{/loop}
		</td>
	</tr>
	<tr>
		<th width="20%"><strong>广告内容</strong></th>
		<td>
			<div id="div_image" style="display:none;">
			{if $info['adstype']=='image'}
				<img src="{UPLOAD_URL}{$info['adscontent']}" width="400" border="0"><br>
			{/if}
				上传图片：<input disabled   type="file" name="file"><br>
				链接地址：<input disabled  {if $info['adstype']=='image'}value="{$info['linkurl']}"{/if} type="text" name="linkurl">
			</div>
			<div id="div_flash" style="display:none;">
			{if $info['adstype']=='flash'}
			<div><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='400' height='50'>	<param name='movie' value='{UPLOAD_URL}{$info['adscontent']}' /><param name='quality' value='high' />	<param name='wmode' value='opaque' />	<embed src='{UPLOAD_URL}{$info['adscontent']}' width='400' height='50' quality='high' wmode='opaque' pluginspage='http://www.macromedia.com/go/getflashplayer\' type=\'application/x-shockwave-flash'></embed></object></div>
			{/if}
				上传flash：<input disabled type="file" name="file"><br>
				链接地址：<input disabled type="text" {if $info['adstype']=='flash'}value="{$info['linkurl']}"{/if} name="linkurl">
			</div>
			<div id="div_link" style="display:none;">
				链接内容：<input disabled type="text" {if $info['adstype']=='link'}value="{$info['adscontent']}"{/if} name="adscontent"><br>
				链接地址：<input disabled type="text" {if $info['adstype']=='link'}value="{$info['linkurl']}"{/if} name="linkurl">
			</div>
			<div id="div_text" style="display:none;">
				<input type="text" disabled {if $info['adstype']=='text'}value="{$info['adscontent']}"{/if} name="adscontent">
			</div>
		</td>
	</tr>
	<tr><th width="20%"><input type="hidden" name="aid" value="{$aid}"></th><td><input type="submit" value=" 确定 " class="button_style">&nbsp;<input type="button" class="button_style" onclick="self.location='{urldecode($forward)}'" value=" 返回 "></td></tr>
</table>
</form>
<script language="javascript">
change_adstype(document.getElementById('type_{$info['adstype']}'));
</script>
{template 'admin','footer'}